﻿#ifndef CALLBACKCTRLI_H
#define CALLBACKCTRLI_H

#include <QObject>
#include "RobotDef.h"
#include "robotwoker.h"

class CallBackCtrlI : public QObject,public NetWorkRobot::CallBack
{
    Q_OBJECT
public:
    explicit CallBackCtrlI(QObject *parent = 0);
    RobotWoker *m_pRobotWoker;

public:
    QString parseJson(QJsonObject jsObj);

signals:
    //tts
    void sig_tts_play(QString strTTS);
    void sig_tts_params(QString strTTS,QString strSpeaker,int nSpeed,int nPitch);
    void sig_tts_play_file(QString strFilePath);
    void sig_tts_volume(int nVolume);
    void sig_tts_stop();
    void sig_tts_Playing();

    //media
    void sig_media_play(QString strFilePath);
    void sig_media_volume(int nVolume);
    void sig_media_stop();
    void sig_media_Playing();

    //asr
    void sig_asr_build(QString strBNF);
    void sig_asr_gramma(QString strName);
    void sig_asr_start(int nMaxDelayMs,bool bCmdMode);
    void sig_asr_stop();

    //enable
    void sig_head_enable(bool bHeadLR,bool bHeadUD);
    void sig_hand_r_enable(bool bHandRExpand,bool bHandRSwing);
    void sig_hand_l_enable(bool bHandLExpand,bool bHandLSwing);

    //init
    void sig_head_lr_init();
    void sig_head_ud_init();
    void sig_hand_r_expand_init();
    void sig_hand_l_expand_init();
    void sig_hand_r_swing_init();
    void sig_hand_l_swing_init();

    //motor
    void sig_head_lr(int nHeadLRAngel,int nHeadLRSpeed);
    void sig_head_ud(int nHeadUDAngel,int nHeadUDSpeed);
    void sig_hand_r_expand(int nHandRExpandAngel,int nHandRExpandSpeed);
    void sig_hand_l_expand(int nHandLExpandAngel,int nHandLExpandSpeed);
    void sig_hand_r_swing(int nHandRSwingAngel,int nHandRSwingSpeed);
    void sig_hand_l_swing(int nHandLSwingAngel,int nHandLSwingSpeed);
    void sig_wheel_run(int nWheelDistance,int nWheelSpeed);
    void sig_wheel_rotate(int nWheelAngel,int nWheelSpeed);
    void sig_wheel_run_diff(bool bLeft,int nLeftSpeed,bool bRight,int nRightSpeed);
    void sig_wheel_stop(bool bStop);

    //script
    void sig_script_play_path(QString strFilePath);
    void sig_script_play_content(QString strContent);
    void sig_script_play_stop();
    void sig_script_playing();

    //json
    void sig_json_load(QString strFilePath);
    void sig_json_key_name(QString strKeyName);
    void sig_json_class_name(QString strClassName);
    void sig_json_stop();
    void sig_json_auto_play();
    void sig_json_playing();
    void sig_json_list();

    //led
    void sig_led_head_eye(int nIndexF,int nIndexB);
    void sig_led_head_eye_2(int nDelay,bool bR,bool bG,bool bB);
    void sig_led_head_ear(int nDelay,bool bR,bool bG,bool bB);
    void sig_led_body(int nDelay,bool bR,bool bG,bool bB);
    void sig_led_touch_set(int nMode,int nColor,int nFreq);

    //avoid
    void sig_set_avoid(bool bAvoid);
    void sig_get_avoid();

    //config
    void sig_set_system_volume(int nVolume);
    void sig_get_system_volume();
    void sig_set_system_cmd(QString strCmd);


    void sig_write_text(QString text);

    // CallBack interface
public:
    std::string recvMsg(const std::string &str, const Ice::Current &);
};

#endif // CALLBACKCTRLI_H
